/*oOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoO

Authors: Nitay Megides
		 Rachel Banino

Project: Exercise 2

Description:
A general module for general functions. Used throughout the project
oOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoO*/

#ifndef GENERAL_H
#define GENERAL_H

#include <windows.h>

#define REPORT_DEBUG printf
#define REPORT_ERROR ReportError

#define THREAD_TERMINATE_TIMEOUT 2000

#define MAX_LINE_LEN 255

typedef struct
{
	int Index;
	int X;
	int Y;
	int Width;
	int Height;
} TArea;
typedef TArea* PArea;


BOOL FileInitialize(const char* outputFilename, const char* errorFilename);
void FileFree();

// Reports outputs to the output file
void ReportIdenticalFacesFound(PArea face1, PArea face2);
// Reports an error to the error log file
void ReportError(const char* format, ...);

// Waits for more than 64 handles. 
// Parameters are like the regular WaitForMultipleObjects, with WaitAll always true.
//
// NOTICE: dwMilliseconds is not the total timeout you will be waiting. This function 
// uses WaitForMultipleObjects several times. For each use, WaitForMultipleMultipleObjects 
// uses the dwMilliseconds argument.
DWORD WaitForMultipleMultipleObjects(DWORD nCount, const HANDLE *lpHandles, DWORD dwMilliseconds);


#endif  // GENERAL_H